Operator Precedence
Operators are evaluated based on their precedence to one another in an expression.
| Precedence | Operator | Usage | Parsing Order |
| 1 | Post increment | a++ | Left to Right |
| Post decrement | a-- | ||
| Member operator | a.b | ||
| Subscript operator | a[b] | ||
| Function call | a(...) | ||
| Parentheses | (...) | ||
| Unit specification | a{unit} | ||
| 2 | Pre increment | ||
| Pre decrement | --a | ||
| Bitwise complement / Matrix inverse | ~a | ||
| Logical NOT | !a | ||
| Unary minus | -a | ||
| Unary plus | +a | ||
| Type conversion | (type)a | ||
| 3 | Multiply | a*b | Left to Right |
| Divide | a/b | ||
| Modulo | a%b | ||
| 4 | Add | a+b | Left to Right |
| Subtract | a-b | ||
| 5 | Shift left | a<<b | Left to Right |
| Shift right | a>>b | ||
| 6 | Less than | a<b | Left to Right |
| Less than or equal | a<=b | ||
| Greater than | a>b | ||
| Greater than or equal | a>=b | ||
| 7 | Equal | a==b | Left to Right |
| Not equal | a!=b | ||
| 8 | Bitwise AND | a&b | Left to Right |
| 9 | Bitwise XOR | a^b | Left to Right |
| 10 | Bitwise OR | a|b | Left to Right |
| 11 | Logical AND | a&&b | Left to Right |
| 12 | Logical OR | a||b | Left to Right |
| 13 | Assignment | a=b | Right to Left |
| Multiply and assign | a*=b | ||
| Divide and assign | a/=b | ||
| Modulo and assign | a%=b | ||
| Add and assign | a+=b | ||
| Subtract and assign | a-=b | ||
| Shift left and assign | a<<=b | ||
| Shift right and assign | a>>=b | ||
| Bitwise AND and assign | a&=b | ||
| Bitwise XOR and assign | a^=b | ||
| Bitwise OR and assign | a|=b | ||
| 14 | Condition | a?b:c | Left to Right |
| 15 | Sequence | a,b | Left to Right |
An operator that is parsed left to right are left associative, whereas those parsed right to left are right associative.
| a = b = c <-> a = (b = c) a + b + c <-> (a + b) + c |